/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager;

import br.com.deployment.entidade.tramite.Secao;
import br.com.deployment.entidade.tramite.Situacao;
import br.com.deployment.message.Msg;
import br.com.deployment.servico.SituacaoServico;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author roniere
 */
@ManagedBean
@ViewScoped
public class ManagerSituacao implements Serializable {

    @EJB
    SituacaoServico situacaoServico;
    
    private Situacao situacao;

    @PostConstruct
    public void init() {
        situacao = new Situacao();
    }

    public Situacao getSituacao() {
        return situacao;
    }

    public void setSituacao(Situacao situacao) {
        this.situacao = situacao;
    }

    public void salvar() {
        situacaoServico.save(situacao);
        Msg.messagemInfo("Salvo com Sucesso");
    }
    
    public List<Situacao> autoComplete(String query) {
        Situacao si = new Situacao();
        si.setNome(query);
        return situacaoServico.find(si);
    }
}
